#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

int n;
int a[5001], f[5001];
int main() {
	freopen("jump.in", "r", stdin);
	freopen("jump.out", "w", stdout);
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		f[i] = 0x7fffffff;
	}
	f[1] = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= a[i]; ++j) {
			f[i + j] = min(f[i + j], f[i] + 1);
		}
	}
	printf("%d", f[n]);
	fclose(stdin);
	fclose(stdout);
	return 0;
}